<?php
namespace User\Model;
use Think\Model;

class OrganiztionItemModel extends Model
{
	protected $tableName = "organiztion_item";
    
    /*
    *获取某活动项目列表
    *@param $orgId 队伍Id
    */
    // public function getItemList($orgId)
    // {
    //     return $this->where(array(''))
    // }

    /*评委对某项目评分
    *@param
    */
    public function setScoreItem($itemId, $organiztionId, $scoreNum)
    {
    	$data['item_id']        =  $itemId;
    	$data['organiztion_id'] =  $organiztionId;
    	$data['score']          =  $scoreNum;
    	$data['create_time']    =  time();

    	$record = $this->where( array('item_id'=>$itemId, 'organiztion_id'=>$organiztionId) )->find();

    	if( !$record )
    	{
    		return $this->where( array('item_id'=>$itemId, 'organiztion_id'=>$organiztion_id) )->add($data);
    	}
    	else
    	{
    		return false;
    	}
   
    }

}
?>